using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class VUbatchttlMap : EntityTypeConfiguration<VUbatchttl>
    {
        public VUbatchttlMap()
        {
            // Primary Key
            this.HasKey(t => new { t.BATCHTYPE, t.RECURRING, t.batchid });

            // Properties
            this.Property(t => t.BATCH)
                .HasMaxLength(8);

            this.Property(t => t.BATCHTYPE)
                .IsRequired()
                .HasMaxLength(2);

            this.Property(t => t.PERIOD)
                .HasMaxLength(4);

            this.Property(t => t.SOURCE)
                .HasMaxLength(2);

            this.Property(t => t.SUBSOURCE)
                .HasMaxLength(3);

            this.Property(t => t.MAINSOURCE)
                .HasMaxLength(2);

            this.Property(t => t.ACCESIBlEFROM)
                .HasMaxLength(3);

            this.Property(t => t.DESC)
                .HasMaxLength(147);

            this.Property(t => t.RECURRING)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.origin)
                .HasMaxLength(2);

            this.Property(t => t.batchid)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("VUbatchttl");
            this.Property(t => t.BATCH).HasColumnName("BATCH");
            this.Property(t => t.TOTAL).HasColumnName("TOTAL");
            this.Property(t => t.TOTALDOL).HasColumnName("TOTALDOL");
            this.Property(t => t.DEBITS).HasColumnName("DEBITS");
            this.Property(t => t.DEBITSDOL).HasColumnName("DEBITSDOL");
            this.Property(t => t.CREDITS).HasColumnName("CREDITS");
            this.Property(t => t.CREDITSDOL).HasColumnName("CREDITSDOL");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.BATCHTYPE).HasColumnName("BATCHTYPE");
            this.Property(t => t.PERIOD).HasColumnName("PERIOD");
            this.Property(t => t.CLOSING).HasColumnName("CLOSING");
            this.Property(t => t.PRNJRNL).HasColumnName("PRNJRNL");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.SOURCE).HasColumnName("SOURCE");
            this.Property(t => t.SUBSOURCE).HasColumnName("SUBSOURCE");
            this.Property(t => t.MAINSOURCE).HasColumnName("MAINSOURCE");
            this.Property(t => t.CSTCTRID).HasColumnName("CSTCTRID");
            this.Property(t => t.ACCESIBlEFROM).HasColumnName("ACCESIBlEFROM");
            this.Property(t => t.CORRECTIVE).HasColumnName("CORRECTIVE");
            this.Property(t => t.File_Primary_Key).HasColumnName("File Primary Key");
            this.Property(t => t.USERID).HasColumnName("USERID");
            this.Property(t => t.DESC).HasColumnName("DESC");
            this.Property(t => t.RECURRING).HasColumnName("RECURRING");
            this.Property(t => t.SUBDATABASE).HasColumnName("SUBDATABASE");
            this.Property(t => t.origin).HasColumnName("origin");
            this.Property(t => t.Voucher).HasColumnName("Voucher");
            this.Property(t => t.batchid).HasColumnName("batchid");
        }
    }
}
